import time
'''
Created on Jun 13, 2009

@author: wcharry
'''

def GetRelativeTime(t):
    k = 1.25
    now = time.time()
    delta = (now) - (t)

    if delta < (1 * k):
      return 'about a second ago'
    elif delta < (60 * (1 / k)):
      return 'about %d seconds ago' % (delta)
    elif delta < (60 * k):
      return 'about a minute ago'
    elif delta < (60 * 60 * (1 / k)):
      return 'about %d minutes ago' % (delta / 60)
    elif delta < (60 * 60 * k):
      return 'about an hour ago'
    elif delta < (60 * 60 * 24 * (1 / k)):
      return 'about %d hours ago' % (delta / (60 * 60))
    elif delta < (60 * 60 * 24 * k):
      return 'about a day ago'
    else:
      return 'about %d days ago' % (delta / (60 * 60 * 24))

if __name__ == '__main__':
    print (GetRelativeTime(time.time() - 360))